package com.example.demo.model.service;

import com.example.demo.model.mapper.MarkMapper;
import com.example.demo.model.valueObject.Mark;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MarkService {
    @Autowired
    private MarkMapper markMapper;
    //根据用户id查询该用户积分
    public Mark retrieveMarkById(String id)
    {
        return markMapper.retrieveMarkById(id);
    }
    //插入新的用户积分
    public void InsertNewUsers(String id)
    {
        markMapper.InsertNewUsers(id);
    }
    //查询所有的用户积分
    public List<Mark> retrieveAllMarks()
    {
        return markMapper.retrieveAllMarks();
    }
    //给用户增加积分
    public void addMarkToAUser(String id,int mark)
    {
        markMapper.addMarkToAUser(id,mark);
    }
    //扣除用户积分
    public void reduceMarkToAUser(String id,int mark)
    {
        markMapper.reduceMarkToAUser(id,mark);
    }
}
